<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" import="java.util.*" pageEncoding="UTF8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
%>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>登录 | 康乃尔设备管理系统</title>
		<link rel="stylesheet" type="text/css" media="all" href="<%=basePath%>sources/css/reset.css" />
		<link rel="stylesheet" type="text/css" media="all" href="<%=basePath%>sources/css/global.css" />
		<link rel="stylesheet" type="text/css" media="all" href="<%=basePath%>sources/css/ui.css" />
		<link rel="stylesheet" type="text/css" media="all" href="<%=basePath%>sources/css/login.css" />
		<script language="javascript">
			function logining(){
				document.forms["index"].submit();
			}
			function reset(){
				document.forms["index"].reset();
			}
			function CheckEnterKey(evt) { 
				if(evt.keyCode == 13) {  
					logining();
				}
			}
		</script>
	</head>
	<body onkeydown="return CheckEnterKey(event)">
	<% 
		String login_error = "";
		login_error = request.getParameter("login_error"); 
		if(login_error!=null){ 
			if(login_error.equals("wrong")){ 
				%>
				<script type="text/javascript">
					alert("您的用户名或密码或验证码不正确或被禁止外网访问。");
				</script>
				<%
			}else if (login_error.equals("user_null_error")) {
				%>
				<script type="text/javascript">
					alert("请输入用户名和密码!");
				</script>
				<%
			}else if (login_error.equals("validation_code_error")) {
				%>
				<script type="text/javascript">
					alert("您输入的验证码不正确,请重新输入!");
				</script>
				<%
			}else if (login_error.equals("user_psw_error")) {
				%>
				<script type="text/javascript">
					alert("您输入的用户名或密码不正确,请重新输入!");
				</script>
				<%
			}
		}
 	%>
		<div class="login-box" >
	    	<form action="servlet/login" method="post" name="index" id="index">
		        <div class="fields">
		            <div class="field">
		                <div class="label">
		                    <label for="username">用户名:</label>
		                </div>
		                <div class="input">
		                    <input type="text" id="zh1" name="j_username" size="20" class="focus" />
		                </div>
		            </div>
		            <div class="clear"></div>
		            <div class="field">
		                <div class="label">
		                    <label for="password">密&nbsp;码:</label>
		                </div>
		                <div class="input">
		                    <input type="password" id="mm1" name="j_password" size="20" class="focus" />
		                </div>
		            </div>
		            <div class="clear"></div>
		            <div class="field" id="verId">
		                <div class="label">
		                    <label for="password">验证码:</label>
		                </div>
		                <div class="input-short">
		                    <input type="text" id="verification" name="j_image_validate_code" size="4" class="focus" />
		                </div>
		                <img alt="看不清点我" name="randImage" id="randImage" src="image.jsp"  onclick="loadimage()" width="50" height="20" border="1" style="float:left;margin:4px 0 0 7px;"/>
		            </div>
		            <div class="clear"></div>
		        </div>
		        <!-- end fields -->
		        <div class="buttons">
		            <a onClick="logining();" id="enter">登录</a>
		            <a onClick="reset();">重置</a>
		        </div>
	        </form>
    	</div>
	</body>
</html>
